package com.jdwx.opengl.kotlin

class IntTransformer: (Int) -> Int {
    override operator fun invoke(x: Int): Int = TODO()
}
final class  AAA constructor( a:Int ){
    public companion object {
    }

}
class HTML {
    fun body() { }
}

fun html(init: HTML.() -> Unit): HTML {
    val html = HTML()  // 创建接收者对象
    html.init()        // 将该接收者对象传给该 lambda
    return html
}

inline fun inlined(block: () -> Int) {
    println("hi!")

}
fun foo() {
    inlined {
        println("hi2!")
        return // OK：该 lambda 表达式是内联的
    }
}
fun main(){
    val repeatFun: String.(Int) -> String = { times -> this.repeat(times) }
    val twoParameters: (String, Int) -> String = repeatFun // OK
    fun runTransformation(f: (String, Int) -> String): String {
        return f("hello", 3)
    }
    val result = runTransformation(repeatFun) // OK

    println("result = $result")


    foo()

}